﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Splitter
{
    class Program
    {
        static void Main(string[] args)
        {
            int parts = Int32.Parse(args[0]);
            int width = Int32.Parse(args[1]);
            int height = Int32.Parse(args[2]);

            for (int i = 0; i < parts - 1; i++)
            {
                genConfigFile(i, width, height, i * (width / parts), 0, (i + 1) * (width / parts), height);
            }

            genConfigFile(parts - 1, width, height, (parts - 1) * (width / parts), 0, width, height);
        }

        static void genConfigFile(int part, int width, int height, int start_x, int start_y, int end_x, int end_y)
        {
            try
            {
                FileStream stream = new FileStream("section" + part + ".rd", FileMode.CreateNew, FileAccess.Write);
                StreamWriter writer = new StreamWriter(stream);
                writer.WriteLine("part = " + part);
                writer.WriteLine("width = " + width);
                writer.WriteLine("height = " + height);
                writer.WriteLine("start_x = " + start_x);
                writer.WriteLine("start_y = " + start_y);
                writer.WriteLine("end_x = " + end_x);
                writer.WriteLine("end_y = " + end_y);
                writer.Close();
            }
            catch (Exception)
            {
                Console.WriteLine("Error writing file...");
            }
        }
    }
}
